home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
187_01
/
getdir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-02-19
|
1KB
|
33 lines
/*@*****************************************************/
/*@ */
/*@ getdir - get text of current path on given drive. */
/*@ */
/*@ Usage: getdir(drive, buffer); */
/*@ where drive is the drive NUMBER (e.g. */
/*@ A: is 1, B: is 2, etc. 0 is the */
/*@ default drive. */
/*@ buffer receives the path name. */
/*@ */
/*@ returns the address of buffer. */
/*@ */
/*@ NOTE: buffer must be at least 64 bytes long. */
/*@ */
/*@*****************************************************/
extern unsigned _rax, _rbx, _rcx, _rdx, _rsi, _rdi, _res, _rds;
extern char _carryf, _zerof;
char *getdir(drive, buffer)
int drive;
char *buffer;
{
buffer[0] = 0x00; /* clear buffer */
_rax = 0x4700; /* set current directory DOS function */
_rdx = drive; /* drive number */
_rds = _showds(); /* current DS segment */
_rsi = &buffer[1]; /* allow for leading \ to be inserted */
_doint(0x21); /* call DOS */
buffer[0] = '\\';
return buffer;
}